<template>
	<view class="">
		<view class="classroom">
			<u-toast ref="uToast" />
			<view class="function_room" :style="{borderColor:leftBorderColor,color:leftColor,background:leftBackground}"
				@click="changeColor(1)">
				功能室
			</view>
			<view class="conference_room"
				:style="{borderColor:centerBorderColor,color:centerColor,background:centerBackground}"
				@click="changeColor(2)">
				会议室
			</view>
			<view class="laboratory" :style="{borderColor:rightBorderColor,color:rightColor,background:rightBackground}"
				@click="changeColor(3)">
				实验室
			</view>
		</view>
		<view class="apply_list" v-for="(item,index) in apply_lists" :key="index">
			<view class="per_apply" @click="$toLink('../function_details/function_details',{})">
				<view class="top">
					<text :class="item.type=='无法处理'?'active':''">{{item.type}}</text>
					<text>{{item.name}}</text>
					<text>ID:</text>
					<text>{{item.meeting_room_id}}</text>
					<image src="../../../static/tupian88.png" mode="widthFix"
						@click.stop="$toLink('../launch_application/launch_application',{meeting_id:item.meeting_room_id,name:item.name,genre:item.type,people:item.people,site:item.place})">
					</image>
				</view>
				<view class="center">
					<image src="../../../static/tupian103.png" mode="widthFix"></image>
					<text>{{item.place}}</text>
				</view>
				<view class="bottom">
					<image src="../../../static/tupian104.png" mode="widthFix"></image>
					<text>{{item.remark}}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import request from '../../../request.js'
	import time from '../../../time.js'
	export default {
		data() {
			return {
				applyLists: [],
				apply_list: [{
						label: '去处理',
						apply_content: '大会议会',
						content: '西楼109-会议室',
						remark: '没有空调',
						num: 'ID:',
						idNumber: '0908',
						url: '../../static/tupian103.png',
						icon: '../../static/tupian88.png',
						note: '../../static/tupian104.png',
					},
					{
						label: '去处理',
						apply_content: '大会议会',
						content: '西楼109-会议室',
						num: 'ID:',
						idNumber: '0908',
						remark: '没有空调',
						url: '../../static/tupian103.png',
						icon: '../../static/tupian88.png',
						note: '../../static/tupian104.png',
					},
					{
						label: '去处理',
						apply_content: '大会议会',
						content: '西楼109-会议室',
						num: 'ID:',
						idNumber: '0908',
						remark: '没有空调',
						url: '../../static/tupian103.png',
						icon: '../../static/tupian88.png',
						note: '../../static/tupian104.png',
					},
					{
						label: '去处理',
						apply_content: '大会议会',
						num: 'ID:',
						idNumber: '0908',
						content: '西楼109-会议室',
						remark: '没有空调',
						url: '../../static/tupian103.png',
						icon: '../../static/tupian88.png',
						note: '../../static/tupian104.png',
					}
				],
				leftBorderColor: '#2f96fe',
				leftColor: '#fff',
				leftBackground: '#2f96fe',
				centerBorderColor: '#F2F2F2',
				centerColor: '#666666',
				centerBackground: '#fff',
				rightBorderColor: '#F2F2F2',
				rightColor: '#666666',
				rightBackground: '#fff',
			}
		},
		computed: {
			apply_lists() {
				if (this.applyLists) {
					return this.applyLists;
				} else {
					return [];
				}
			}
		},
		// onShow() {
		// 	this.meetingLists(1);
		// },
		methods: {
			changeColor(param) {
				switch (param) {
					case 1:
						if (this.leftBorderColor == '#F2F2F2') {
							this.leftBorderColor = '#2f96fe';
							this.leftColor = '#fff';
							this.leftBackground = '#2f96fe';
							this.centerBorderColor = '#F2F2F2';
							this.centerColor = '#666666';
							this.centerBackground = '#fff';
							this.rightBorderColor = '#F2F2F2';
							this.rightColor = '#666666';
							this.rightBackground = '#fff';
						} else {
							this.leftBorderColor = '#F2F2F2';
							this.leftColor = '#666666';
							this.leftBackground = '#fff';
						}
						this.meetingLists(1);
						break;
					case 2:
						if (this.centerBorderColor == '#F2F2F2') {
							this.centerBorderColor = '#2f96fe';
							this.centerColor = '#fff';
							this.centerBackground = '#2f96fe';
							this.leftBorderColor = '#F2F2F2';
							this.leftColor = '#666666';
							this.leftBackground = '#fff';
							this.rightBorderColor = '#F2F2F2';
							this.rightColor = '#666666';
							this.rightBackground = '#fff';
						} else {
							this.centerBorderColor = '#F2F2F2';
							this.centerColor = '#666666';
							this.centerBackground = '#fff';
						}
						this.meetingLists(2);
						break;
					case 3:
						if (this.rightBorderColor == '#F2F2F2') {
							this.rightBorderColor = '#2f96fe';
							this.rightColor = '#fff';
							this.rightBackground = '#2f96fe';
							this.leftBorderColor = '#F2F2F2';
							this.leftColor = '#666666';
							this.leftBackground = '#fff';
							this.centerBorderColor = '#F2F2F2';
							this.centerColor = '#666666';
							this.centerBackground = '#fff';
						} else {
							this.rightBorderColor = '#F2F2F2';
							this.rightColor = '#666666';
							this.rightBackground = '#fff';
						}
						this.meetingLists(3);
						break;
				}
			},
			meetingLists(param) {
				let _this = this;
				let str = this.$classroom(param);
				let obj = {
					type: str
				};
				request({
					url: this.$baseUrl + 'teacher/meeting_room/lists',
					method: 'post',
					data: {
						...obj
					},
					success(res) {
						if (res.statusCode == 200) {
							console.log(res.data.data.data);
							_this.applyLists = res.data.data.data;
						} else {
							_this.$refs.uToast.show({
								title: res.data.message || '系统错误',
								type: 'warning',
							})
						}

					}
				})
			},

		}
	}
</script>

<style lang="scss">
	.classroom {
		height: 110rpx;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: flex-start;
		border-bottom: 1px solid #F2F2F2;

		.function_room {
			width: 129rpx;
			height: 61rpx;
			display: flex;
			justify-content: center;
			border-radius: 12rpx;
			margin-left: 61rpx;
			color: #fff;
			box-sizing: border-box;
			font-size: 24rpx;
			border: 1rpx solid #2f96fe;
			background: #2f96fe;
			align-items: center;
		}

		.conference_room {
			width: 129rpx;
			height: 61rpx;
			margin-left: 120rpx;
			display: flex;
			justify-content: center;
			box-sizing: border-box;
			border-radius: 12rpx;
			color: #666666;
			font-size: 24rpx;
			background: #fff;
			border: 1rpx solid #F2F2F2;
			align-items: center;
		}

		.laboratory {
			width: 129rpx;
			height: 61rpx;
			margin-left: 120rpx;
			display: flex;
			justify-content: center;
			border-radius: 12rpx;
			box-sizing: border-box;
			color: #666666;
			font-size: 24rpx;
			border: 1rpx solid #F2F2F2;
			background: #fff;
			align-items: center;
		}

	}

	.apply_list {
		width: 100%;
		height: 203rpx;
		overflow: hidden;

		.per_apply {
			margin-top: 22rpx;
			margin-left: 20rpx;
			height: 179rpx;
			width: 710rpx;
			border-radius: 12rpx;
			box-shadow: 0px 1px 1px 1px #ccc;

			.top {
				width: 100%;
				height: 60rpx;
				display: flex;
				justify-content: flex-start;

				text {
					margin-top: 20rpx;

					&:nth-child(1) {
						background-color: #ABC0F7;
						width: 60rpx;
						margin-left: 20rpx;
						margin-top: 25rpx;
						height: 30rpx;
						border-radius: 8rpx;
						color: #fff;
						font-size: 16rpx;
						text-align: center;
						line-height: 30rpx;
					}

					&:nth-child(2) {
						color: #333333;
						margin-left: 20rpx;
						width: 150rpx;
						font-size: 28rpx;
					}

					&:nth-child(3) {
						color: #333333;
						margin-top: 22rpx;
						font-size: 26rpx;

					}

					&:nth-child(4) {
						margin-left: 20rpx;
						color: #333333;
						width: 350rpx;
						margin-top: 22rpx;
						font-size: 26rpx;
					}

				}

				image {
					&:nth-child(5) {
						width: 30rpx;
						margin-top: 20rpx;
					}
				}

				.active {
					background: #EC654E !important;
				}
			}

			.center {
				width: 100%;
				height: 55rpx;
				display: flex;
				justify-content: flex-start;

				image {
					&:nth-child(1) {
						margin-top: 25rpx;
						margin-left: 20rpx;
						width: 30rpx;
					}
				}

				text {
					&:nth-child(2) {
						margin-top: 25rpx;
						margin-left: 30rpx;
						font-size: 24rpx;
						color: #666666;
					}
				}

			}

			.bottom {
				width: 100%;
				height: 45rpx;
				display: flex;
				justify-content: flex-start;

				image {
					&:nth-child(1) {
						margin-top: 15rpx;
						margin-left: 20rpx;
						width: 30rpx;
					}
				}

				text {
					&:nth-child(2) {
						margin-top: 15rpx;
						margin-left: 30rpx;
						font-size: 24rpx;
						color: #666666;
					}
				}
			}
		}
	}
</style>
